def binary_search(sorted_seq, target):
    left = 0
    right = len(sorted_seq) - 1
    while left <= right:
        midpoint = (left+right)//2
        current_item = sorted_seq[midpoint]
        if current_item == target:
            return midpoint
        elif target < current_item:
            right = midpoint - 1
        else:
            left = midpoint + 1
    return None


if __name__ == '__main__':
    sorted_sequence = [i for i in range(1, 999, 2)]
    print(binary_search(sorted_sequence, target=521))
